package com.deer.wms.ware.task.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.deer.wms.intercept.common.data.CurrentUser;
import com.deer.wms.project.root.core.service.QueryCriteria;
import com.deer.wms.project.root.service.SuperService;
import com.deer.wms.ware.task.model.SO.CreateSo.CreateSo;
import com.deer.wms.ware.task.model.SO.*;
import com.deer.wms.ware.task.model.SO.vo.SoDetailVo;
import com.deer.wms.ware.task.model.SO.vo.SoMasterVo;

import java.util.List;
import java.util.Map;


/**
 *
 * @author guo
 * @since 2020/02/02
 */
public interface SoMasterService extends SuperService<SoMaster> {

    List<SoMasterDto> findList(SoMasterCriteria criteria);

    List<SoMasterDto> findByWaveId(Integer id, Integer wareId);

    SoMasterDto getSeedingByItemCode(String itemCode, Integer wareId, Integer waveMasterId);

    /**
     * 生成出库单
     * @param soData SO数据
     * @param currentUser 当前用户
     */
    void createSoMaster(SoData soData, CurrentUser currentUser);

    void deleteByBillNo(String billNo);

    void createFile(String billNo, CurrentUser currentUser);

    List<SoMaster> findSoGroupInfo(SoMasterCriteria criteria);

    /**
     * 按照波次ID和SO的状态查询满足条件的SO数量
     * @param waveMasterId 波次ID
     * @param state SO状态
     * @return Integer
     */
    Integer findCountByWaveIdAndState(Integer waveMasterId,Integer state);

    /**
     * 根据波次策略查询满足条件的SO单
     * @param criteria SO查询条件
     * @return List<SoMaster>
     */
    List<SoMaster> findSoByWave(SoMasterCriteria criteria);

    List<SoMaster> findCanTongBu();

    void setCarriersWithRouteTactic();

    List<PdaSearchSoData> pdaSearchSo(String trackCode);

    SoMasterYdyp getYdyp(String itemCode, Integer wareId, Integer waveId);

    SoMasterYdyp getYdyp2(String billNo, Integer wareId, Integer waveId);

    void createSO(CreateSo createSo, CurrentUser currentUser);

    /**
     * 获取SO单中最大的优先级数
     * @return Integer
     */
    Integer getMaxPriority();

    void updatePriority(Integer soMasterId, Integer priority);

    SoMaster findBy(String field, String value);

    /**
     * 按单出库
     * @param soMaster so单据号
     * @param currentUser 当前用户
     */
    void sendOut(SoMaster soMaster, CurrentUser currentUser);

    //从erp抓取出采购出库单信息数据
    String saveBillOutInfo();

    //出库单回传erp
    String outbillToErp();

    //出库单回传erp
    String outbillToErpNew(String billNo);

    /**
     * 生成先发配件出库单
     * @param soData SO数据
     * @param currentUser 当前用户
     */
    void createSoMaster2(SoData soData, CurrentUser currentUser);

    //查询先发配件出库任务
    List<SoMasterDto> findList2(SoMasterCriteria criteria);

    /**
     * 生成原材料出库单
     * @param soData SO数据
     * @param currentUser 当前用户
     */
    void createSoMaster3(SoData soData, CurrentUser currentUser);

    //查询原材料出库任务
    List<SoMasterDto> findList3(SoMasterCriteria criteria);

    /**
     * 获取任务数据
     * @param page
     * @return
     */
    List<SoMasterVo> alignList(QueryCriteria criteria);


    /**
     * 齐套提交
     * @param soDetailVo
     */
    void submitQitao(SoDetailVo soDetailVo);

    /**
     * 获取token
     */
    public String requestToken();
}
